package LanQiao._15JavaB;

import java.util.*;

public class _6 {

    //WA  超时  19/20 优化下应该就能过
    public static class Node{
        List<Integer> list;
        public Node(){
            list = new ArrayList<>();
        }
        public List<Integer> getList(){
            return list;
        }
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        int Q = sc.nextInt();
        Node[] nodes = new Node[n + 1];
        for (int i = 0; i < m; i++) {
            int ai = sc.nextInt();
            int bi = sc.nextInt();
            if (nodes[ai] == null) {
                nodes[ai] = new Node();
            }
            nodes[ai].getList().add(bi);
            if (nodes[bi] == null) {
                nodes[bi] = new Node();
            }
            nodes[bi].getList().add(ai);
        }

        double sum = 0;
        for (int i = 0; i < Q; i++) {
            int xi = sc.nextInt();
            int yi = sc.nextInt();
            int helper = helper(xi, yi, nodes);
            sum += helper;
        }
        System.out.printf("%.2f", sum / Q);
        sc.close();
    }

    public static int helper(int xi,int yi,Node[] nodes){
        int res = 0;
        Queue<Integer> queue = new LinkedList<>();
        HashSet<Integer> visited = new HashSet<>();
        queue.add(xi);
        visited.add(xi);
        while (!queue.isEmpty() && yi > 0){
            int size = queue.size();
            res += size;
            for (int i = 0; i < size; i++) {
                Integer poll = queue.poll();
                if (nodes[poll] != null) {
                    List<Integer> list = nodes[poll].getList();
                    for (Integer integer : list) {
                        if (!visited.contains(integer)) {
                            visited.add(integer);
                            queue.add(integer);
                        }
                    }
                }
            }
            yi--;
        }
        res += queue.size();
        return res;
    }
}
